package org.zhzh.crawler.pipeline;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.zhzh.crawler.model.BTHeavenModel;
import org.zhzh.crawler.service.BTHeavenService;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

@Service
public class BTHeavenPipeline implements Pipeline {

	@Autowired
	private BTHeavenService btHeavenService;

	public void process(ResultItems resultItems, Task task) {
		BTHeavenModel model = resultItems.get("model");
		if (model == null) {
			return;
		}
		btHeavenService.insertBTHeaven(model);
	}

}
